let mainul = document.querySelector('.mainul ');
let id = 1;
async function getData() {
    let res = await pAjax({
        url: `../JSON/cinemas-${id}.json`,
    });
    res = JSON.parse(res);
    console.log(res.data.cinemas);
    Runder(res.data.cinemas)
}
getData();

function Runder(data) {
    let str = '';
    data.forEach(item => {
        if (item.cityId == 20) {

            str += `
            <li>
            <h3>${item.nm}</h3>
            <span class="price">${item.price}</span><em>元起</em>
            <p class="add">${item.addr} <i>${item.distance}</i></p>
            <p class="smallIcons">
                <i class="zuo">座</i>
                <i class="ting"></i>
                <i class="tui">退</i>
                <i class="gaiqian">改签</i>
                <i class="xiaochi">小吃</i>
            </p>
            <p class="foot">
                <i>惠</i>
                <span>${item.promotion.platformActivityTag}</span>
            </p>
        </li>
            `;
        }
    });
    // console.log(str);

    mainul.innerHTML += str;

}


$('main').scroll(function () {
    if (Math.ceil($(this)[0].scrollHeight) - Math.ceil($('main').scrollTop()) - Math.ceil($('main').height()) == 0) {
        id++;
        console.log(id);
        getData();
        return;
    }



})